package lzzy;

public class Ellipse extends GeometricObject{
    private double semiMajorAxis; //长半轴
    private double semiMinorAxis; //短半轴

    public Ellipse() {
    }

    public Ellipse(double semiMajorAxis, double semiMinorAxis) {
        this.semiMajorAxis = semiMajorAxis;
        this.semiMinorAxis = semiMinorAxis;
    }

    public double getSemiMajorAxis() {
        return semiMajorAxis;
    }
    public void setSemiMinorAxis(double semiMinorAxis) {
        this.semiMajorAxis = semiMajorAxis;
    }

    public double getSemiMinorAxis() {
        return semiMinorAxis;
    }
    public void setSemiMajorAxis(double semiMinorAxis) {
        this.semiMinorAxis = semiMinorAxis;
    }

    public double getArea() {
        return Math.PI * semiMajorAxis * semiMinorAxis;
    }
    public double getPerimeter() {
        return 2 * Math.PI * semiMinorAxis + 4*(semiMajorAxis-semiMinorAxis);
    }
}
